﻿@inject IDataCacheService _dataCacheService
@inject NavigationManager NavigationManager
@inject IJSRuntime JS
@inject IEventService _eventService


@if (Model.RelevancesState == EditState.Preview)
{
    <CnGalWebSite.Shared.MasaComponent.Shared.Editors.Buttons.RevokeButton Url="@("/entries/EditRelevances/" + Model.Id)" ExamineType="Operation.EstablishRelevances" OnClickRevoke="OnRevoke" />
}
<CnGalWebSite.Components.Containers.MasaTitleContainer Outline Title="动态" ShowMoreButton OnClickMore="@(()=>{Dialog=true;})" Icon="@IconType.News.ToIconString()">
     <NewsCard Model="Model.NewsOfEntry.Take(2)" />
 </CnGalWebSite.Components.Containers.MasaTitleContainer>

 <MDialog @bind-Value="Dialog"
          Width="1000">
     <MDCard>
         <MCardTitle Class="text-h5">
             动态
         </MCardTitle>
         <MCardText>
             @Model.Name 的所有动态
         </MCardText>
         <MCardText>
             <NewsCard Model="Model.NewsOfEntry" OnCloseed=OnCloseed />
         </MCardText>
     </MDCard>
 </MDialog>

 @code {
    [Parameter]
    public EntryIndexViewModel Model { get; set; }
    [Parameter]
    public EventCallback<Operation> OnRevoke { get; set; }

    bool Dialog { get; set; }

    public void OnCloseed()
    {
        Dialog=false;
        StateHasChanged();
    }

}
